# YOLO 一键自动按键助手配置文件

class Config:
    # Flask配置
    SECRET_KEY = 'yolo-auto-press-secret-key-2024'
    DEBUG = True
    HOST = '0.0.0.0'
    PORT = 5000
    
    # YOLO配置
    MODEL_CONFIDENCE_THRESHOLD = 0.5
    DETECTION_INTERVAL = 0.1  # 秒
    
    # 屏幕检测配置
    DEFAULT_SCREEN_AREA = {
        'x': 0,
        'y': 0,
        'width': 1920,
        'height': 1080
    }
    
    # 按键配置
    SUPPORTED_KEYS = [
        'space', 'enter', 'tab', 'esc',
        'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
        'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
        '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'
    ]
    
    # 日志配置
    MAX_LOG_ENTRIES = 5
    LOG_TIMESTAMP_FORMAT = '%H:%M:%S'
    
    # 安全配置
    PYAUTOGUI_FAILSAFE = True
    PYAUTOGUI_PAUSE = 0.1

# 支持的文件类型
ALLOWED_EXTENSIONS = {'pt'}

def allowed_file(filename):
    return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
